package com.sunline.poc.oozie.config;

import com.sunline.poc.oozie.vo.UserInfoVO;

public class LoginUserContext {
    private static ThreadLocal<UserInfoVO> currentUser = new ThreadLocal<>();

    public static UserInfoVO getLoginUser(){
        UserInfoVO userInfo =  currentUser.get();
        if (userInfo == null){
            throw  new RuntimeException("user not login");
        }
        return userInfo;
    }
    public static void setLoginUser(UserInfoVO user){
        currentUser.set(user);
    }

    public static void cleanLoginUser(){
        currentUser.set(null);
    }
}
